<template>
  <div>
    <div class="title">
      <span><i>1</i>输入找回账号</span>
      <span class="active"><i>2</i>回答密保问题</span>
      <span><i>3</i>重置密码</span>
    </div>
    <div class="box">
      <div class="input-item">
        <label> 用户名：</label>
        <input type="text" value="xxxx" disabled v-model="username" />
      </div>
      <div class="input-item">
        <label> 手机号：</label>
        <input type="text" value="xxxx" disabled v-model="phone" />
      </div>
      <div class="input-item">
        <label>密保问题：</label>
        <input type="text" value="xxxxxxx" disabled v-model="question" />
      </div>
      <div class="input-item">
        <label>密保答案：</label>
        <input type="text" v-model="answer" />
      </div>
      <button @click="change">上一步</button>
      <button @click="next2">下一步</button>
    </div>
  </div>
</template>

<script>
import axios from "axios";
axios.defaults.baseURL = "http://124.223.14.236:3001/api";
export default {
  props: {
    obj: {
      type: Object,
      require: true,
    },
  },
  data() {
    return {
      username: "",
      phone: "",
      question: "",
      answer: "",
      id: "",
    };
  },
  methods: {
    change() {
      this.$emit("change", "step1");
    },
    next2() {
      if (this.answer.trim().length === 0) return alert("密保答案不能为空");
      this.$emit("change", "step3");
      this.$emit("answer", this.answer);
    },
  },
  created() {
    //用户信息回显到表单中
    this.username = this.obj.username;
    this.phone = this.obj.phone;
    this.question = this.obj.question;
  },
};
</script>

<style scoped>
@import url("@/assets/css/index.css");
</style>
